<!--
 * @Author: hejianbo
 * @Date: 2024-06-16 09:55:29
 * @LastEditors: hejianbo
 * @FilePath: /src/views/login/index.vue
 * @Description: 登录页
-->

<template>
  <div>
    <el-form :model="ruleForm">
      <el-form-item label="手机号:" prop="mobilePhone">
        <input type="text" v-model="ruleForm.mobilePhone" />
      </el-form-item>
      <el-form-item label="密码:" prop="password">
        <input type="text" v-model="ruleForm.password" />
      </el-form-item>
      <!-- <el-form-item label="项目id:" prop="projectId">
        <input type="text" v-model="ruleForm.projectId" />
      </el-form-item> -->
    </el-form>

    <button @click="handleConfirm">登录</button>
  </div>
</template>
<script>
export default {
  name: "",
  components: {},
  props: {},
  data() {
    const { projectId, redirectPath } = this.$store.state;
    return {
      redirectPath: redirectPath || "/",
      ruleForm: {
        mobilePhone: "",
        password: "",
        projectId,
      },
    };
  },
  created() {},
  mounted() {},
  watch: {},
  computed: {},
  methods: {
    handleConfirm() {
      this.$store.dispatch("LogIn", this.ruleForm).then(() => {
        this.$router.replace(this.redirectPath);
        this.$store.commit("SET_REDIRECT_PATH", { fullPath: "" });
      });
    },
  },
};
</script>
<style></style>
